home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
music
/
ptmid.arj
/
PTMID.DOC
< prev
next >
Wrap
Text File
|
1994-01-06
|
11KB
|
240 lines
NAME
ptmid - Converts MIDI music files to Protracker files (ver 0.1)
SYNOPSIS
ptmid [-cFile] [-dChannel] [-fFrac] [-q] infile[.mid]
[outfile[.mod]]
DESCRIPTION
Ptmid will take either standard MIDI format 0 or format 1 files and
convert them into various Protracker-type files. MIDI files are
industry standard, but need some sort of sequencer to be played, as
there can be near infinite simultaneous notes (though about 20 is a
standard maximum). Protracker files are 4 channel (though 6 and 8
channel varieties are supported) files, but have a bank of
digitized instruments included, so reasonable quality sound is
produced given limited hardware.
The differences between MIDI (extension .mid) and Protracker
(extension .mod) formats are more than superficial, and a fair bit
of information is needed to be able perform the conversion - most
of this is held in the configuration file: ptmid.cfg
The format of ptmid.cfg is fairly simple: Any line beginning with a
hash (#) is ignored, other lines contain configuration info. The
first word on a line specifies what sort of information (and
sometimes only one word is needed), anything following this word is
used as supplementary information and depends of the sort of option
specified by the first word. Here are a list of options and
descriptions:
def, xx, or dxx (where xx is a number): These options supply
information on what samples (digitized instruments) should be
allocated to what MIDI instrument numbers. "def" is the
default non-percussion instrument, and must always be
specified. "xx" is a specific MIDI instrument. "dxx" is a
specific MIDI percussion instrument (non-specified percussion
instruments are not converted). After the option name are the
filenames of the samples that can be used to represent the
instrument. Multiple filenames may be specified, except for
percussion instruments which may only have one.
sample: This option is followed by the filename of a sample
and its pitch when played at 8287 Hz (or for percussion
samples, the note to play). Optionally, it can then be
followed by a loop-start offset and a loop-length (in that
order), specified in words (1 word = 2 bytes). After a sample
is played it will stop if no loop information is given,
otherwise it will start looping at the loop-start address and
continue for the length of the loop-length (looping continues
indefinitely). Pitch is given by a note letter (A, B, C,
etc.), optionally followed by a sharp sign (#), followed by
the octave of the note (.. 0, 1, 2 ..) where middle C is in
octave 2 (an octave ranges from the C in that octave to the B#
above). A sample must be specified for EVERY filename given in
one of the above options (def, xx, dxx).
drumch: The percussion channel is assumed to be 10, but some
MIDI devices assume it is elsewhere, and so Ptmid must know
what channel it will be to perform a correct conversion.
Following the option name is a number which is the percussion
channel. Common values are 10 and 16.
fract: Ptmid quantizes (that is, groups notes to the closest
note) MIDI files duration conversion, and so must know what
the smallest type of note is. Following the option name is a
number (possibly with a suffix of "t") which represents a type
of note - this is the quantize fraction. Valid fractions are
of the form: 4, 4t, 8, 8t, 16, 16t, etc. where 4 means a
quarter note (crotchet), 4t means a triplet, 8 means an
eighth-note (quaver), 8t means quaver-triplets, etc. It
usually can't hurt to give a smaller note (larger value),
though it uses up more memory, but the critical part is
knowing if a triplet note is needed. If not specified, the
fraction is assumed to be 16. This option can be overridden
with the similar option specified on the command line.
patchan: To aid in supporting multiple Protracker-type formats
this option allows you to specify the number of channels (max.
of 8). Following the option name is the number of channels. If
not specified, it defaults to 4.
patmax: Following this option is the maximum number of
patterns. It will default to 64, and has a maximum of 128. You
should only need to specify a larger value if you get a
warning that during conversion, Ptmid has reached the pattern
maximum.
formid: Following this option is a 4-letter string which is
used as an ID by the program which plays Protracker files (a
tracker) to determine the above 2 values. It defaults to
"M.K.". Common combinations of these 3 options are:
ptchan patmax formid
4 64 M.K.
4 128 M!K!
6 64 6CHN
8 64 8CHN
(These formid values are supported by the DMP tracker.)
extend: If this option is present, then an extended range of
notes is allowed during conversion. Usually there is a 3
octave range, but since MIDI allows a 9 octave range
converted files can sound wrong. With an extended range, 5
octaves are supported, but you need special trackers for this
(the tracker DMP is one example). The best solution for this
problem is to use multiple samples, each of which is digitized
an octave apart, and specify all of them for an instrument.
nocopy: This option will stop copyrighted MIDI files being
converted if it is present. Since MIDI files support a
copyright notice as part of their official format, I thought
that this would be a good option for the fascist-minded.
Options in the configuration file may be given in any order, and
are all optional except for "def" and "sample".
DMP is written by Otto Crons (no relation :).
How Ptmid works. Well.. Firstly it reads the entire MIDI file
(except hardware dependent effects) into memory as a series of
chords, quantizing as it goes. Then it scans the its copy of the
tune and allocates samples to each note, and converts volumes etc.
After doing this it writes it to a Protracker format file (MOD
file), if there are more notes than channels then it picks what it
guesses to be shorter notes rather than longer notes. The reason
behind this is that shorter notes allow more notes to come later,
freeing up channels sooner.. okay, so it's not a very good reason.
I originally wanted to do "channel pruning" before the writing
stage occurred, but yes I'm slack and wanted to get a working copy
released. Anyway, this means there is a bit of inelegancy: samples
may be allocated to notes, but those notes are pruned later on and
are never played, leaving redundant samples.
OPTIONS
cFile "File" is the filename of the configuration file. If not
given will default to "ptmid.cfg". See above for format
of the configuration file.
dChannel "Channel" is a number from 1 to 16. This is the channel
used for percussion instruments. See "drumch" option
above.
fFrac "Frac" is a quantize fraction. It can take values of the
form: 4, 4t, 8, 8t, etc. See the "fract" option above,
which this option overrides.
q Enables quiet-mode. Only error messages are sent (to
stderr).
EXAMPLES
prompt> ptmid -f32t jazz3
ptmid ver 0.1: Converting 'jazz3.mid' to 'jazz3.mod'
Ticks to quantize: 16
Number of tracks: 6
Analyzing..
Writing..
Writing 6 samples: ......
Done.
prompt>
DIAGNOSTICS
The following errors terminate immediately and return an exit code
of 1.
Cannot find config file: xxxx
Either ptmid.cfg cannot be found (eg. not in current
directory) or the file specified with the option -c has been
incorrectly given.
Error in config file: line xx
Something is wrong with the config file on that line. Check
the above formats for options.
No default instrument defined in config file
Make sure there is a "def" option in the config file.
No sample definitions found in config file
Likewise, make sure there is a "sample" option.
Invalid quantize fraction - using default
You have incorrectly specified the fraction in the -f option.
Make sure it is of a similar form to: 4, 4t, 8, 8t, etc. Ptmid
is going ahead, but using the value 16.
Cannot access file: xxxx
The MIDI file you have specified cannot be opened for reading.
Not a legal MIDI file: xxxx
There is something wrong with the MIDI file you have
specified (like it isn't one), or there is a copyright notice
in it and the NOCOPY option has been enabled (see above).
Cannot create file: xxxx
The Protracker file cannot be opened for writing.
No more files can be opened
While reading the MIDI file, Ptmid has run out of file handles
(there should be at least 1 more than the number of tracks in
the file), so if you can increase them, please do.
Cannot allocate any more memory
Nasty. Try recompiling the sources to use a bigger memory
model, install more memory (probably make no difference),
switch to a different operating system, or wait until other
users leave.
The follow errors do not terminate immediately, though may cause
early termination, hence will return an exit code of 0.
Warning -- Pattern limit xx reached. Aborting!
If "xx" reads "128" then try using a smaller number for the
quantize fraction, otherwise try increasing the maximum number
of patterns (in configuration file - see above). A MOD file
will be created anyway, so at least you will have something.
Andrew Scott
INTERNET:ascott@tartarus.uwa.edu.au